﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinFormsApp1
{
    public partial class GetSushu : Form
    {
        public GetSushu()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
        int num_low = 0;
        int num_high = 0;
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            //num_low = Convert.ToInt32(textBox1.Text);
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
           // num_high = Convert.ToInt32(textBox2.Text);
        }

        private void button1_MouseClick(object sender, MouseEventArgs e)
        {
            num_low = int.Parse(textBox1.Text);
            num_high = int.Parse(textBox2.Text);
            int sushunum = 0;
            for(int a = num_low;a < num_high + 1; a++)
            {
                bool issushu = true;
                for (int i = 2; i < a ; i++)
                {
                    if(a%i == 0)
                    {
                        issushu = false;
                    }
                }
                if(issushu == true)
                {
                    sushunum += 1;
                    if(sushunum % 10 == 0)
                    {
                        label1.Text = label1.Text  + Convert.ToString(a) + "," + "\n";
                    }
                    else
                    {
                        label1.Text = label1.Text  +Convert.ToString(a) + ",";
                    }
                    
                }
            }
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
    }
}
